package ejemplosAR;

import processing.core.PApplet;
import processing.video.*;

import jp.nyatla.nyar4psg.*;

public class PngMarker extends PApplet {

	private static final long serialVersionUID = 1L;
	private static final String PARA = "/Users/marthagarzon/Desktop/Juan Manuel/Workspace/ModuloSimulacion/data/camera_para.dat";
	private static final String HIRO_PNG = "/Users/marthagarzon/Desktop/Juan Manuel/Workspace/ModuloSimulacion/data/hiro.png";

	private Capture cam;
	private MultiMarker nya;

	public void setup() {
		size(640,480,P3D);
		colorMode(RGB, 100);
		println(MultiMarker.VERSION);
		cam=new Capture(this,640,480);
		nya=new MultiMarker(this,width,height,PARA,NyAR4PsgConfig.CONFIG_PSG);
		nya.addARMarker(loadImage(HIRO_PNG),16,25,80);
	}

	public void draw()
	{
		if (cam.available()) 
		{
			cam.read();
			nya.detect(cam);
			background(0);
			nya.drawBackground(cam);
			if(nya.isExistMarker(0))
			{
				nya.beginTransform(0);
				fill(0,0,255);
				translate(0,0,20);
				box(40);
				nya.endTransform();
			}
		}
	}

}